
#ifndef _MLKitDefine_

#define _MLKitDefine_

#define IOS_VERSION ([[[UIDevice currentDevice] systemVersion]floatValue])
#define APPDELEGATE ([UIApplication sharedApplication].delegate)

#define APP_NAME ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"])
#define APP_BUNDLE_NAME ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"])
#define APP_VERSION ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"])
#define APP_BUILD_NUMBER ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"])

@class MLUUID,MLDeviceModel;
#define DEVICE_MODEL ([MLDeviceModel model])
#define APP_UUID ([MLUUID UUID])

#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height

#define WEAKSELF __weak __typeof(self)weakSelf = self;
#define STRONGSELF __strong __typeof(weakSelf)sSelf = weakSelf;

#define CHILD(childClass,object) \
((childClass *)object) \
\

#define SIMPLE_INTEGER_STRING(o) [NSString stringWithFormat:@"%ld",(NSInteger)(o)]

#define SELSTR(sel) (NSStringFromSelector(@selector(sel)))

#define SHOW_SIMPLE_TIPS(m) [[[UIAlertView alloc] initWithTitle:@"" message:(m) delegate:nil cancelButtonTitle:@"好的" otherButtonTitles:nil]show];

//HUD
#define SHOW_HUD(m) [MLProgressHUD showHUDAddedTo:(m) animated:YES];
#define HIDE_HUD(m) [MLProgressHUD hideAllHUDsForView:(m) animated:YES];

//一些提示
//不阻塞window
#define SHOW_WINDOW_TIPS(m) [MLProgressHUD showTips:(m) withUserInteractionEnabled:NO andView:[APPDELEGATE window]];
//阻塞window
#define SHOW_INTERCATION_WINDOW_TIPS(m) [MLProgressHUD showTips:(m) withUserInteractionEnabled:YES andView:[APPDELEGATE window]];
//不阻塞view
#define SHOW_VIEW_TIPS(m,v) [MLProgressHUD showTips:(m) withUserInteractionEnabled:NO andView:(v)];
//阻塞view
#define SHOW_INTERCATION_VIEW_TIPS(m,v) [MLProgressHUD showTips:(m) withUserInteractionEnabled:YES andView:(v)];

//错误提示，这里暂时和SHOW_WINDOW_TIPS一样，保留为了以后自定义方便
#define SHOW_ERROR_TIPS(m) [MLProgressHUD showTips:(m) withUserInteractionEnabled:NO andView:[APPDELEGATE window]];


#define MLKIT_BUNDLE_NAME @"MLKit.bundle"
#define MLKIT_BUNDLE_FILE(file) [MLKIT_BUNDLE_NAME stringByAppendingPathComponent:file]

static inline UIStatusBarStyle kAppBaseStatusBarStyle() {
    static UIStatusBarStyle _appBaseStatusBarStyle = UIStatusBarStyleDefault;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        NSArray *statusBarStyles = @[@"UIStatusBarStyleDefault",@"UIStatusBarStyleLightContent",@"UIStatusBarStyleBlackTranslucent",@"UIStatusBarStyleBlackOpaque"];
        _appBaseStatusBarStyle = [statusBarStyles indexOfObject:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIStatusBarStyle"]];
        if ((NSInteger)_appBaseStatusBarStyle==NSNotFound) {
            _appBaseStatusBarStyle = UIStatusBarStyleDefault;
        }
    });
    
    return _appBaseStatusBarStyle;
}

#define APP_BASE_STATUS_BAR_STYLE (kAppBaseStatusBarStyle())

//系统字体快速
#define FONT(s) ([UIFont systemFontOfSize:(s)])
#define BOLDFONT(s) ([UIFont boldSystemFontOfSize:(s)])

#endif /* _MLKitDefine_ */